/**
 * Project Name:jbase
 * File Name:DefaultWebSearcherLauncher.java
 * Package Name:jbase.project.system.net.http.websearch
 * Date:2017年4月30日下午6:10:33
 * Copyright (c) 2017, chenzhou1025@126.com All Rights Reserved.
 *
*/

package jbase.project.system.net.http.websearcher;

import java.util.Arrays;
import java.util.List;

import jbase.project.system.core.InterfaceProxyFactory;
import jbase.project.system.core.common.EventHook;

/**
 * ClassName:DefaultWebSearcherLauncher <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON. <br/>
 * Date: 2017年4月30日 下午6:10:33 <br/>
 * 
 * @author Licheng
 * @version
 * @since JDK 1.8
 * @see
 */
public class DefaultWebSearcherLauncher {
	public static void main(String[] args) {
		EventHook hook = InterfaceProxyFactory.newInstance().makeProxy((proxy, method, arguments) -> {
			System.out.printf("method %s invoked, parameters:\n", method.getName());
			String event = (String) arguments[0];
			if (event.equals("DownloadSourceFound")) {
				System.out.println("download:" + (String) ((Object[]) arguments[1])[0]);
			} else if (event.equals("with")) {
				System.out.println("with:" + (String) ((Object[]) arguments[1])[0]);
			}
			return null;
		}, EventHook.class);
		// http://www.ladykity.com
		// List<String> include =
		// Arrays.asList(".*[Ww]{3}\\.27270\\.[Cc][Oo][Mm]/ent/meinvtupian/.*");
		// List<String> exclude = Arrays.asList();
		// List<String> downRegex =
		// Arrays.asList(".*\\.([Jj][Pp][Ee]?[Gg]|[Pp][Nn][Gg]|[Gg][Ii][Ff]|[Bb][Mm][Pp])");
		// List<String> starturl =
		// Arrays.asList("http://www.27270.com/ent/meinvtupian/");

		List<String> include = Arrays.asList(".*[Ww]{3}\\.[lL][aA][dD][yY][Kk][iI][tT][yY]\\.[Cc][Oo][Mm]/.*");
		List<String> exclude = Arrays.asList();
		List<String> downRegex = Arrays.asList(".*\\.([Jj][Pp][Ee]?[Gg]|[Pp][Nn][Gg]|[Gg][Ii][Ff]|[Bb][Mm][Pp])");
		List<String> starturl = Arrays.asList("http://www.ladykity.com/");

		WebSearcher finder = new WebSearcher(hook, new DefaultImgFindMemoryServiceProvider("H:\\BaiduYunDownload", hook,
				starturl, include, exclude, downRegex));
		finder.start();

	}
}
